package com.yjd.comm.fs.file.model;

import com.yjd.comm.fs.file.IUpWrap;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

/**
 * 按文件上传包装对象
 * 
 * @author ready
 * 
 */
public class FileUpWrap implements IUpWrap {
	/**
	 * 保存的绝对路径
	 */
	private String saveAbsFilePath;
	/**
	 * 上传的文件
	 */
	private File file;

	public FileUpWrap() {
	}

	public FileUpWrap(String saveAbsFilePath, File file) {
		super();
		this.saveAbsFilePath = saveAbsFilePath;
		this.file = file;
	}

	public String getSaveAbsFilePath() throws Exception {
		return saveAbsFilePath;
	}

	public void setSaveAbsFilePath(String saveAbsFilePath) {
		this.saveAbsFilePath = saveAbsFilePath;
	}

	public File getFile() {
		return file;
	}

	public void setFile(File file) {
		this.file = file;
	}

	@Override
	public InputStream getInputStream() throws Exception {
		return new FileInputStream(this.file);
	}

	@Override
	public String getFileName() throws Exception {
		return this.file.getName();
	}
}